/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controlelrl;

import gui.Principal1;


/**
 *
 * @author Victor
 */
public class ControleLRL {

    private static ControleLRL controleLRL;
    private Thread threadOn;
    private static Principal1 principal1;
    
    public static Principal1 getFrame() {
        if (principal1 == null)
            principal1 = new Principal1();
            
        return principal1;
    }

    private ControleLRL() {
    }
    
    public static ControleLRL getInstance(){
        if (controleLRL == null)
            controleLRL = new ControleLRL();
        
        return controleLRL;
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        getFrame().setResizable(true);
        
    }
    
    public void inicializarTanque(int signalType) {
        Tanque t = new Tanque();
        t.setMaxAmp(Double.parseDouble(getFrame().getTSinaisPanel().getAmpMax().getText()));
        t.setMinAmp(Double.parseDouble(getFrame().getTSinaisPanel().getAmpMin().getText()));
        t.setSignalType(signalType);
        
        if (threadOn != null)
            threadOn.interrupt();
        
        threadOn = new Thread(t);
        synchronized (this) {
            threadOn.start();
        }
    }
        
    
}
